package cn.com.surker.pages.console;

import cn.com.surker.common.AbstractController;
import cn.com.surker.system.entity.SysOrigin;
import cn.com.surker.system.entity.SysUser;
import cn.hutool.core.util.ObjectUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Slf4j
@Controller
@RequestMapping("/console/base")
public class SysControlPageController extends AbstractController {

    /**
     * 工控仓位信息
     * @return
     */
    @RequestMapping(value = "/control/storage")
    public ModelAndView controlStorage() {
        ModelAndView modelAndView = new ModelAndView();
        SysUser user = getUser();
        if (ObjectUtil.isEmpty(user)) {//未登录用户
            modelAndView.setViewName("console/system/login");
            return modelAndView;
        }
        List<SysOrigin> orgList = getUserOrgList();
        modelAndView.addObject("orgList", orgList);
        modelAndView.setViewName("console/base/sys-control-storage");
        return modelAndView;
    }

}
